<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title></title>
    <link rel="stylesheet" type="text/css" href="admin.css" />

    <wicket:head>
      <script type="text/javascript">
        function updateLineAndRowNumber()
        {
          var textArea = document.getElementById("txtEdit_SimpleEditorComponent");
          if (document.selection) { //Internet Exporer workaround
            textArea.selectedText = document.selection.createRange().text;
            textArea.selectionStart = textArea.value.indexOf(textArea.selectedText);
            textArea.selectionEnd = textArea.selectionStart + textArea.selectedText.length;
            if (textArea.selectionStart < 0) {
              textArea.selectionStart = 0;
              textArea.selectionEnd = 0;
            }
          }

          var overAllOffset = Math.min(textArea.selectionStart,textArea.selectionEnd);
          
          var text = textArea.value;

          // get the line and row number (the stupid way)
          var row = 1;
          var col = 1;
          
          for(var i=0; i < overAllOffset; i++)
          {
            if(text.charAt(i) == '\n')
            {
              //alert('newline');
              row++;
              col = 1;
            }
            else
            {
              col++;
            }
          }

          document.getElementById('lblLine').innerHTML = '' + row;
          document.getElementById('lblRow').innerHTML = '' + col;
        }

      </script>
    </wicket:head>

  </head>
  <body>
    <wicket:panel>
      <form wicket:id="form" action="">
        <div>
          <textarea id="txtEdit_SimpleEditorComponent" onmouseup="updateLineAndRowNumber()" onkeyup="updateLineAndRowNumber()" wicket:id="txtEdit" cols="80" rows="20" wrap="off">
          </textarea>

        </div>
        <div style="text-align:right">
          <span id="lblLine">0</span>:<span id="lblRow">0</span>
        </div>
      </form>  

    </wicket:panel>

  </body>
</html>